//
//  XMGLoginField.m
//  BuDeJie
//
//  Created by 陈恒均 on 2018/1/25.
//  Copyright © 2018年 小码哥. All rights reserved.
//

#import "XMGLoginField.h"
#import "UITextField+PlaceHolder.h"

@implementation XMGLoginField

-(void)awakeFromNib
{
    [super awakeFromNib];
    
    self.tintColor = [UIColor whiteColor];
    
    [self addTarget:self action:@selector(textBegin) forControlEvents:UIControlEventEditingDidBegin];
    
    [self addTarget:self action:@selector(textEnd) forControlEvents:UIControlEventEditingDidEnd];
    
//    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
//    attrs[NSForegroundColorAttributeName] = [UIColor lightGrayColor];
//    self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder attributes:attrs];
    
    self.placeHolderColor = [UIColor lightGrayColor];
    
}
-(void)textBegin
{
    
//    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
//    attrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
//    self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder attributes:attrs];
    
     self.placeHolderColor = [UIColor whiteColor];
}
-(void)textEnd
{
    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
    attrs[NSForegroundColorAttributeName] = [UIColor lightGrayColor];
    self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder attributes:attrs];
    
     self.placeHolderColor = [UIColor lightGrayColor];
}

@end
